admin: Use internal pull API instead of subprocess
authorColin Walters <walters@verbum.org>
Tue, 9 Jul 2013 22:23:55 +0000 (18:23 -0400)
committerColin Walters <walters@verbum.org>
Tue, 9 Jul 2013 22:34:05 +0000 (18:34 -0400)
So we're doing more of the library thing.

src/ostree/ot-admin-builtin-upgrade.c
src/ostree/ot-admin-functions.c
src/ostree/ot-admin-functions.h

index 5663c4fe01c5d40a6dc3e41589d8445907a77ce6..1222803c5fa6ed761131d90d2c0095d067a53b40 100644 (file)
@@ -25,6 +25,7 @@
 #include "ot-admin-builtins.h"
 #include "ot-admin-functions.h"
 #include "ot-admin-deploy.h"
+#include "ostree-pull.h"
 #include "ostree.h"
 #include "otutil.h"
 
@@ -118,9 +119,12 @@ ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
 
   if (origin_remote)
     {
+      char *refs_to_fetch[] = { origin_ref, NULL };
+
       g_print ("Fetching remote %s ref %s\n", origin_remote, origin_ref);
-      if (!ot_admin_pull (admin_opts->sysroot, origin_remote, origin_ref,
-                          cancellable, error))
+
+      if (!ostree_pull (repo, origin_remote, refs_to_fetch, OSTREE_PULL_FLAGS_NONE,
+                        cancellable, error))
         goto out;
     }
 
index e97250b3e16914fe447f2134c34946ed398e56d4..1b469ebe34feffd710a0e08718c6ac55a05bd038 100644 (file)
@@ -776,24 +776,6 @@ ot_admin_list_deployments (GFile               *sysroot,
   return ret;
 }
 
-gboolean
-ot_admin_pull (GFile         *sysroot,
-               const char    *remote,
-               const char    *ref,
-               GCancellable  *cancellable,
-               GError       **error)
-{
-  gs_unref_object GFile *repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
-  gs_free char *repo_arg = g_strconcat ("--repo=",
-                                        gs_file_get_path_cached (repo_path),
-                                        NULL);
-
-  return gs_subprocess_simple_run_sync (NULL,
-                                        GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
-                                        cancellable, error,
-                                        "ostree", repo_arg, "pull", remote, ref, NULL);
-}
-
 GFile *
 ot_admin_get_deployment_directory (GFile        *sysroot,
                                    OtDeployment *deployment)
index ad2a932404f0ab7a56bbd6591bd144fc2158c0db..21195b56f9eedc8eac87dc45b18284ac619e310f 100644 (file)
@@ -118,12 +118,6 @@ gboolean ot_admin_get_default_ostree_dir (GFile        **out_ostree_dir,
 
 GKeyFile *ot_origin_new_from_refspec (const char *refspec);
 
-gboolean ot_admin_pull (GFile         *ostree_dir,
-                        const char    *remote,
-                        const char    *ref,
-                        GCancellable  *cancellable,
-                        GError       **error);
-
 G_END_DECLS
 
 #endif